package com.nali.spreader.dao.impl;

import com.nali.spreader.dao.ICrudKeywordDao;
import com.nali.spreader.data.Keyword;
import com.nali.spreader.data.KeywordExample;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

@Repository
public class CrudKeywordDao implements ICrudKeywordDao {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Mon Apr 23 15:44:11 CST 2012
     */
    public CrudKeywordDao() {
        super();
    }

    /**
     * This field was generated by Apache iBATIS ibator.
     * This field corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    @Autowired
    private SqlMapClientTemplate sqlMap;

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int countByExample(KeywordExample example) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("spreader_tb_keyword.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int deleteByExample(KeywordExample example) {
        int rows = getSqlMapClientTemplate().delete("spreader_tb_keyword.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int deleteByPrimaryKey(Long id) {
        Keyword key = new Keyword();
        key.setId(id);
        int rows = getSqlMapClientTemplate().delete("spreader_tb_keyword.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public void insert(Keyword record) {
        getSqlMapClientTemplate().insert("spreader_tb_keyword.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public void insertSelective(Keyword record) {
        getSqlMapClientTemplate().insert("spreader_tb_keyword.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    @SuppressWarnings("unchecked")
    public List<Keyword> selectByExample(KeywordExample example) {
        List<Keyword> list = getSqlMapClientTemplate().queryForList("spreader_tb_keyword.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public Keyword selectByPrimaryKey(Long id) {
        Keyword key = new Keyword();
        key.setId(id);
        Keyword record = (Keyword) getSqlMapClientTemplate().queryForObject("spreader_tb_keyword.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int updateByExampleSelective(Keyword record, KeywordExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_keyword.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int updateByExample(Keyword record, KeywordExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_keyword.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int updateByPrimaryKeySelective(Keyword record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_keyword.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public int updateByPrimaryKey(Keyword record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_keyword.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    public SqlMapClientTemplate getSqlMapClientTemplate() {
        return sqlMap;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table spreader.tb_keyword
     *
     * @ibatorgenerated Wed May 16 11:11:11 CST 2012
     */
    private static class UpdateByExampleParms extends KeywordExample {

        private Object record;

        public UpdateByExampleParms(Object record, KeywordExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}
